package com.yanqu.road.server.cmd.chefduel;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ShanHeFeastProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.chefduel.CrossChefDuelActivityMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C_CROSS_CHEF_DUEL_TEST_CODE, desc = "测试指令")
public class CrossChefDuelTestCodetCmd extends CrossCommand {

    private int activityId;

    private long userId;

    private String code;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ShanHeFeastProto.CrossFeastTestCodeReqMsg reqMsg = ShanHeFeastProto.CrossFeastTestCodeReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        userId = packet.getPlayerId();
        code = reqMsg.getCode();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossChefDuelActivityMgr.testCode(activityId, serverId, userId, code);
    }

    @Override
    public void sendData() {

    }
}
